python os path join list

33

# The problem is, os.path.join doesn't take a list as argument, it has to be separate arguments.
# This is where *, the 'splat' operator comes into play...
>>> s = "c:/,home,foo,bar,some.txt".split(",")
>>> os.path.join(*s)
'c:/home\\foo\\bar\\some.txt'

Comments

Submit
0 Comments